import callback from '../function/callback'

function findKey(obj, predicate, context) {
  predicate = callback(predicate, context)
  let keys = Object.keys(obj),
    key
  for (let i = 0; i < keys.length; ++i) {
    key = keys[i]
    if (predicate(obj[key], key, obj)) {
      return key
    }
  }
}

export default findKey
